{% extends 'teacher_base.html' %}

{% block context %}
 <div>
        <div class="bd-example">
        <table class="table table-striped" style="margin:0 150px;width: 80%;text-align: center;vertical-align: middle" >
          <thead>
          <tr>
            <th scope="col">#</th>
            <th scope="col">课程名</th>
            <th scope="col">创建时间</th>
            <th scope="col">学生人数</th>
            <th scope="col">状态</th>
            <th scope="col">操作</th>
          </tr>
          </thead>
          <tbody>
          {% if infos %}
              {% for info in infos %}
            <tr>
                <th scope="row">{{ forloop.counter }}</th>
                <td>{{ info.name }}</td>
                <td>{{ info.time }}</td>
                <td>{{ info.num }}</td>
                {% if info.exam_set %}
                    <td>开始时间{{ info.start_time }}<br>结束时间{{ info.end_time }}<br>考试时长{{ info.time_limit }}分钟</td>
                {% else %}
                    <td>暂未安排考试</td>
                {% endif %}
                <td><a href="{% url 'teacher:managecourse' course_id=info.course_id %}">管理</a> <a href="{% url 'teacher:setexampaper' %}?course={{ info.name }}">考试设置</a></td>
            </tr>
          {% endfor %}
          {% else %}
            <tr><td colspan="5" align="center">暂未添加课程</td></tr>
          {% endif %}

          </tbody>
        </table>
        </div>
 </div>
{% endblock %}